#ifndef __IPACKAGE_HPP__
#define __IPACKAGE_HPP__

#include "PackageReader.h"
#include "PackageWriter.h"
#include "PackageManager.h"
#include <memory>
#include "IBasePackage.hpp"

using namespace PocketSurvival::Engine;

namespace PocketSurvival
{
    class Client;
    typedef std::shared_ptr<Client> ClientPtr;

    enum PackageSendType
    {
        TARGET,         // 目标客户端, client不能为nullptr
        EXCEPT,         // 跳过该客户端, client为nullptr的话，跟ALL一样
        ALL             // 所有人都发
    };

    class IPackage : public IBasePackage, public std::enable_shared_from_this<IPackage>
    {
    public:
        PackageSendType     sendType        = PackageSendType::ALL;
        ClientPtr           client          = nullptr;
        DeliveryMethod      sendMethod      = DeliveryMethod::ReliableOrdered;

        inline virtual ClientState getMinNeedState();
        inline virtual uint8_t getChannelNumber();
    };

    inline ClientState IPackage::getMinNeedState()
    {
        return ClientState::Connected;
    }

    inline uint8_t IPackage::getChannelNumber()
    {
        return 0;
    }
}

#endif